home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 103 / XENIATGM103.iso / Shareware / GoLive 5.0 / MM10.Cab / F2669_db_x.js.2221A912_0B60_4050_989B_99AD310F0534 < prev    next >
Text File  |  2000-08-17  |  4KB  |  103 lines

  1. var timer;
  2. var timer2;
  3.  
  4. function PreLocalSearch()
  5. {
  6.     timer = setTimeout( "localSearch()", 10 );
  7. }
  8.  
  9. function localSearch()
  10. {
  11.     var index;
  12.     var searchTerm;
  13.     var matchStr;
  14.     var fileIndicesArr;
  15.     var dbSliceFile;
  16.     var firstLetterIndex;
  17.     
  18.     // Clear the timer
  19.         clearTimeout( timer );
  20.         
  21.     // Get the passed-in index (corresponding to which search expression word we are now on)
  22.         //index = location.search.substr(1, location.search.length);
  23.         index = top.frames["Help_left"].glob_NdxCurrentWord++;
  24.  
  25.     // Get the search word corresponding to this index.
  26.         searchTerm = top.frames["Help_left"].allSearchTerms[index];
  27.  
  28.     // Trim it to the maximum length
  29.         searchTerm = searchTerm.substring(0,12);
  30.  
  31.     // See if the (current) search term/word is found in this file's "words" array
  32.         if( words[searchTerm] ) {
  33.  
  34.             // ^^^^^^^^^^^^^^^^^^^^^^^
  35.             // ^^^^^ MATCH FOUND ^^^^^
  36.             // ^^^^^^^^^^^^^^^^^^^^^^^
  37.  
  38.                 //................................................................
  39.                 //.....Get the list of file indices associated with this word.....
  40.                 //................................................................
  41.                     matchStr = words[searchTerm];
  42.                     
  43.                 //....................................................
  44.                 //.....Split this list into separate file indices.....
  45.                 //....................................................
  46.                     fileIndicesArr = matchStr.split(",");
  47.                     
  48.                 //......................................................................
  49.                 //.....Process each file index, bumping the 'indexHitsArr' as we go.....
  50.                 //......................................................................
  51.                     for( var ndx = 1; ndx < fileIndicesArr.length; ndx++ ) {
  52.                         top.frames["Help_left"].indexHitsArr[fileIndicesArr[ndx]]++;
  53.                     }
  54.             
  55.                 //.....................................................................
  56.                 //.....See if we are done processing all of the search words/terms.....
  57.                 //.....................................................................
  58.                     if( top.frames["Help_left"].glob_NdxCurrentWord >= top.frames["Help_left"].allSearchTerms.length ) {
  59.                         // We are done. 
  60.                         PreCallShowResults();
  61.                         return; 
  62.                     }
  63.                             
  64.                 //........................................................................
  65.                 //.....Prepare for and execute the processing of the next search word.....
  66.                 //........................................................................
  67.                     firstLetterIndex =     top.frames["Help_left"].allSearchTerms[top.frames["Help_left"].glob_NdxCurrentWord].charCodeAt(0);
  68.  
  69.                     dbSliceFile = top.dbFilesArr[firstLetterIndex];
  70.                     if( dbSliceFile.length > 0 ) {
  71.                         // Our NEXT entered word starts with a letter that 
  72.                         // has a corresponding search db "slice"
  73.                         // 
  74.                         // ***********************************
  75.                         // Handle the next "DAISY CHAIN" step.
  76.                         // ***********************************
  77.                         top.frames["search_cache"].location = dbSliceFile;
  78.                     }
  79.                     else {
  80.                         // Our first entered word starts with a letter 
  81.                         // not represented by any search db "slice"
  82.                         top.frames["Help_left"].searchResults_FAIL();
  83.                     }
  84.  
  85.         }
  86.         else {
  87.             // ^^^^^^^^^^^^^^^^^^^^^^^^^^
  88.             // ^^^^^ NO MATCH FOUND ^^^^^
  89.             // ^^^^^^^^^^^^^^^^^^^^^^^^^^
  90.                 top.frames["Help_left"].searchResults_FAIL();
  91.         }
  92. }
  93.  
  94. function PreCallShowResults()
  95. {
  96.     timer2 = setTimeout( "callShowResults()", 10 );
  97. }
  98. function callShowResults()
  99. {
  100.     top.frames["Help_left"].assessFinalSearchResults();
  101.     clearTimeout( timer2 );
  102. }
  103.